import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '@/views/login.vue'
import register from '@/views/register.vue'

import index from '@/views/index/index.vue'
import postdetail from '@/views/index/postdetail.vue'
import more from '@/views/index/MoreComments.vue'
import search from '@/views/index/search.vue'

import peraonal from '@/views/personal.vue'
import edit from '@/views/centre/edit.vue'
import attention from '@/views/centre/attention.vue'
import follow from '@/views/centre/follow.vue'
import collect from '@/views/centre/collect.vue'

import columns from '@/views/index/columns.vue'

import dome from '@/views/dome.vue'
Vue.use(VueRouter)

  const routes = [
  {   // 测试页面
    path:'/dome',
    name:'dome',
    component:dome
  },
  {  //登录页
    path: '/login',
    name: 'login',
    component: login
  },
  {  //注册页
    path:'/register',
    name:'register',
    component: register
  },
  {  //首页
    path:'/',
    name:'index',
    component:index
  },
  {  //文章详情页   动态路由传递文章id
    path:'/postdetail/:id',
    name:'postdetail',
    component:postdetail 
  },
  {  //精彩评论页  动态路由传递文章id
    path:'/more/:id',
    name:'more',
    component:more,
    meta:{
      define:true
    }
  },
  {
    path:'/search',
    name:'search',
    component:search
  },
  {  //个人中心
    path:'/personal',
    name:'personal',
    component:peraonal,
    meta:{
      define:true
    }
  },
  {  //个人资料编辑
    path:'/edit',
    name:'edit',
    component:edit,
    meta:{
      define:true
    }
  },
  {  //我的关注
    path:'/attention',
    name:'attention',
    component:attention,
    meta:{
      define:true
    }
  },
  {  //我的跟帖
    path:'/follow',
    name:'follow',
    component:follow,
    meta:{
      define:true
    }
  },
  {  //我的收藏
    path:'/collect',
    name:'collect',
    component:collect,
    meta:{    //添加跳转时判断用户登录的自定义变量
      define:true
    }
  },
  {  //栏目管理
    path:'/columns',
    name:'columns',
    component:columns
  }
]

const router = new VueRouter({
  routes
})

export default router
